package com.heima.wemedia.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNewsStatistics;
import com.heima.wemedia.mapper.WmNewsStatisticsMapper;
import com.heima.wemedia.service.WmNewsStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 自媒体图文数据统计表 服务实现类
 * </p>
 *
 * @author longjialian
 */
@Slf4j
@Service
@Transactional
public class WmNewsStatisticsServiceImpl extends ServiceImpl<WmNewsStatisticsMapper, WmNewsStatistics> implements WmNewsStatisticsService {

    @Override
    public ResponseResult newsPage(String beginDate, String endDate) {
        IPage page = new Page(1, 10);
        page = this.page(page);
        PageResponseResult result = new PageResponseResult(1, 10, (int) page.getTotal());
        result.setData(page.getRecords());
        return result;
    }
}
